package com.pp.wsi;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

public class CountryCity {
	
	private String country;
	private String city;
	
	private List<CountryCity> map;
	
	public CountryCity(String country , String city) {
		this.setCountry(country);
		this.setCity(city);	
	}
	
	public CountryCity() {
		map = new ArrayList<CountryCity>();
		
		map.add(new CountryCity("Polska" , "Bydgoszcz"));
		map.add(new CountryCity("Polska" , "Poznan"));
		map.add(new CountryCity("Polska" , "Warszawa"));
		map.add(new CountryCity("Polska" , "Krakow"));
		map.add(new CountryCity("Polska" , "Szczecin"));
		map.add(new CountryCity("Polska" , "Wroclaw"));
		map.add(new CountryCity("Polska" , "Zakopane"));
		map.add(new CountryCity("Polska" , "Gdansk"));
		map.add(new CountryCity("Niemcy" , "Berlin"));
		map.add(new CountryCity("Niemcy" , "Hamburg"));
		map.add(new CountryCity("Czechy" , "Praga"));
		map.add(new CountryCity("Czechy" , "Liberc"));
		map.add(new CountryCity("Anglia" , "Machester"));
		map.add(new CountryCity("Anglia" , "London"));
		map.add(new CountryCity("Anglia" , "Liverpol"));
		map.add(new CountryCity("Anglia" , "Tottenham"));
		
		
	}
	
	
	public  Set<String> getCountries() {
		Set<String> country = new HashSet<String>();		
		for (CountryCity element : map) {
			try {
				country.add(element.getCountry());	
			}catch (Exception e){}
		}
		return country;
	}
	
	
	public Set<String> getCities(String country) {		
		Set<String> city = new HashSet<String>();	
		for (CountryCity element : map) {	
			if (element.getCountry().equals(country)){
				try {
					city.add(element.getCity());	
				}catch (Exception e){}		
			}
				
		}			
		return city;
	}

	public void setCountry(String country) {
		this.country = country;
	}

	public void setCity(String city) {
		this.city = city;
	}
	
	public String getCountry() {
		return this.country;		
	}
	
	public String getCity() {
		return this.city;
	}
	}


	
	
	


